﻿@using LibMinecraft.Model; 
@{
    MinecraftServer server = null;
    var pingImg = "/images/ping";
    var pingTitle = "";
    var motdClass = "";
    if (@Model.Query.ContainsKey("serverip"))
    {
        server = MinecraftServer.GetServer(@Model.Query["serverip"]);
        pingTitle = server.PingTime + "ms";
        int ping = 4;
        if (server.PingTime > 150) { ping--; }
        if (server.PingTime > 250) { ping--; }
        if (server.PingTime > 350) { ping--; }
        if (server.PingTime > 450) { ping--; }
        pingImg += ping.ToString() + ".png";
        if (server.PingTime == 0)
        {
            pingImg = "/images/pingnone.png";
            server.MotD = "Can't reach server";
            motdClass = "red";
        }
        if (string.IsNullOrEmpty(server.MotD))
        {
            server.MotD = "&nbsp;";
        }
    }
}
<!DOCTYPE html>
<html>
<head>
    <title>Minecraft Web Launcher</title>
    <link rel="stylesheet" href="/info.css" type="text/css" />
    <link rel="stylesheet" href="/font.css" type="text/css" />
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
</head>
<body>
    <div id="framewrapper">
        <iframe frameborder="0" id="container" src="http://mcupdate.tumblr.com/"></iframe>
    </div>
    <div id="login-container">
        <div id="rightFloated">
            @if (server != null)
            {
            <div id="server">
                <img class="ping" alt="ping" src="@pingImg" title="@pingTitle" />
                <p class="players">@server.ConnectedPlayers/@server.MaxPlayers</p>
                <h2>Connect to server:</h2>
                <div class="@motdClass">@server.MotD</div>
                <div class="light">@Model.Query["serverip"]</div>
                <a href="?">Cancel</a>
            </div>
            }

            <form id="loginForm" method="post" action="/launch.html">

            <div class="left">
                <div>
                    <span class="label">Username:</span>
                    <input type="text" name="username" id="username" />
                </div>
                <div>
                    <span class="label">Password:</span>
                    <input type="password" name="password" id="password" />
                </div>
                <input type="checkbox" name="remember" id="remember" /><label for="remember">Remember password</label>
            </div>
            <div class="right">
                <a href="#" style="margin: 6px auto;">Privacy</a>
                @if (server != null)
                {
                    <input type="hidden" name="server" value="@Model.Query["serverip"]" />
                }
                <input type="submit" value="Login" />
                <a href="http://minecraft.net/profile" style="margin-top: 7px;">Need account?</a>
            </div>

            </form>
        </div>
        <a id="logo" href="http://minecraft.net"><img src="http://www.minecraft.net/images/logo.png" /></a>
        <p id="disclaimer">Not affiliated with Mojang.</p>
    </div>
</body>
</html>
